<include file="Public:header" />
<div class="page-member subpage">
    <div class="form-header">
        <div>
            <div class="line1">
                <div class="fl"><h3>年审批次详情 / {$batch.name}</h3></div>
                <div class="fr hidden">
                    <form class="search-form" method="post" action="">
                        <input name="field" value="{$context.field}" type="hidden" />
                        <input name="value" value="{$context.value}" type="hidden" />
                        <input name="page" value="{$context.page}" type="hidden" />
                        <input name="order_field" value="{$context.order_field}" type="hidden" />
                        <input name="order_sort" value="{$context.order_sort}" type="hidden" />
                        <input name="offset" value="{$context.offset}" type="hidden" />
                        <input name="id" value="{$context.id}" type="hidden" />
                    </form>
                </div>
            </div>
            <div class="line2">
                <!-- 编辑按钮组 -->
                <if condition="$batch.state eq '未启动'">
                    <div class="fl form-btn-group btn-group-edit">
                        <in name="$x|default='02-02-02'" value="$rightsCode">
                            <button onclick="action_startNS();" class="btn-save btn-highlight">启动年审</button>
                            <else />
                            <button disabled="disabled" class="btn-save btn-disable">启动年审</button>
                        </in>
                        <span>或</span>
                        <a onclick="action_edit();" class="linkBtn" href="javascript:void(0);">编 辑</a>
                    </div>
                </if>
                <if condition="$batch.state eq '已启动'">
                    <div class="fl form-btn-group btn-group-edit">
                        <in name="$x|default='02-02-02'" value="$rightsCode">
                            <button onclick="action_endNS();" class="btn-save btn-highlight">结束年审</button>
                            <else />
                            <button disabled="disabled" class="btn-save btn-disable">结束年审</button>
                        </in>
                        <span>或</span>
                        <a onclick="action_edit();" class="linkBtn" href="javascript:void(0);">编 辑</a>
                    </div>
                </if>
                <!-- 保存按钮组 -->
                <div class="fl form-btn-group btn-group-save hidden">
                    <in name="$x|default='02-02-02'" value="$rightsCode">
                        <button onclick="action_save();" class="btn-save btn-highlight">保 存</button>
                        <else />
                        <button disabled="disabled" class="btn-save btn-disable">保 存</button>
                    </in>
                    <span>或</span>
                    <a class="linkBtn btn-abort" onclick="action_abort();" href="javascript:void(0);">放弃</a>
                </div>
                <div class="fl form-btn-more">
                    <button class="btn-normal btn-more">
                        更多操作<i class="drop-down"></i>
                    </button>
                    <ul class="more-action hidden">
                        <in name="$x|default='02-02-02'" value="$rightsCode">
                            <li><a onclick="action_del2();" href="javascript:void(0);">删 除</a></li>
                        </in>
                    </ul>
                </div>
                <div class="fr form-search-count">
                    <span class="index">{$context.index}/{$page.total}</span>
                    <button onclick="ItemJump({$page.prev.id}, {$page.prev.offset});" class="btn-normal">上一条</button>
                    <button onclick="ItemJump({$page.next.id}, {$page.next.offset});" class="btn-normal">下一条</button>
                </div>
            </div>
        </div>
    </div>
    <div class="form-box2">
        <div>
            <form id="batchForm" method="post" action="">
                <!--表单相关原始信息存储-->
                <input type="hidden" name="old_name" value="{$batch.name}" />
                <input type="hidden" name="old_state" value="{$batch.state}" />
                <input type="hidden" name="old_year" value="{$batch.year}" />
                <input type="hidden" name="old_remarks" value="{$batch.remarks}" />
                <table class="form">
                    <tr>
                        <th width="15%">批次名称<span class="hint">*</span></th>
                        <td width="35%" field="name">{$batch.name}</td>
                        <th>状态</th>
                        <td>{$batch.state}</td>
                    </tr>
                    <tr>
                        <th width="15%">年审年份<span class="hint">*</span></th>
                        <td field="year">{$batch.year}</td>
                        <th>年审对象数量</th>
                        <td field="num">{$batch.num}</td>
                    </tr>
                    <tr style="vertical-align: top">
                        <th>备注</th>
                        <td field="remarks">{$batch.remarks}</td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
<script>
    function action_endNS(){
        var a=confirm("您确定要结束年审吗?");
        if(a==true)
        {
            var year = $("input[name=old_year]").val();
            $.ajax({
                url:"/admin/nianshenBatch/ajax_endNS",
                data: {year: year}, type:"POST", dataType:"JSON",
                success: function(data){
                    if(data.status){
                        alert("操作成功");
                        location.reload();
                    }else{
                        alert(data.info);
                    }
                }
            });
        }
    }
    function action_startNS(){
        var year = $("input[name=old_year]").val();
        location.href = '/admin/nianshenBatch/loading?year='+year;
    }
</script>
<script src="__JS__/nianshenBatch.js" type="text/javascript" ></script>
<include file="Public:footer" />
